<!-- <link rel="stylesheet" href="./css/common.css" /> -->
<div class="footer">
  <div class="footer-top">
    <div class="wrapper">
      <div class="footer-top-item">
        <div class="footer-province">省</div>
        <div class="footer-province-con">
          <span>全</span><i id="province-name"></i>
        </div>
        <div class="city-name">
          <span id="city-all"></span>
        </div>
      </div>
      <div class="footer-top-item">
        <div class="footer-top-item">
          <div class="footer-province">热</div>
          <div class="footer-province-con"><span>周</span>边城市</div>
          <div class="city-name">
            <span id="city-periphery"></span>
          </div>
        </div>
      </div>
      <div class="footer-top-item">
        <div class="footer-province">热</div>
        <div class="footer-province-con"><span>热</span>门城市</div>
        <div class="city-name">
          <span id="city-hot"></span>
        </div>
      </div>
      <div class="footer-top-item">
        <div class="footer-province">友</div>
        <div class="footer-province-con"><span>友</span>情链接</div>
        <div class="city-name">
          <span>
            <a href="https://www.58.com/" target="_blank" rel="nofollow"
              >58同城</a
            >
            <a href="http://www.ganji.com/" target="_blank" rel="nofollow"
              >赶集网</a
            >
            <a href="https://www.meituan.com/" target="_blank" rel="nofollow"
              >美团网</a
            >
            <a href="https://www.dianping.com/" target="_blank" rel="nofollow"
              >大众点评网</a
            >
          </span>
        </div>
      </div>
      <!-- <div class="footer-top-item">
        <img src="./image/icon/inddex_dianhua_icon.png" alt="汇融名企" />
        <div class="footer-top-title">
          <h3>小时服务热线：</h3>
          <h4>400-566-6688</h4>
        </div>
        <div class="city-name">
          <span>地址：河北石家庄市长安区嘉禾广场4号楼 </span>
        </div>
      </div> -->
    </div>
  </div>
  <div class="footer-bottom">
    <div id="statistical"></div>
    <p><strong>汇融名企</strong>是面向全国商家服务的大型互联网平台，多市场多行业多方向资源整合，广阔的市场资源结合专业团队，负责细心提供精准有效的商业服务，优质平台客户值得信赖！平台集合全国优质企业和商家案例，实现优质服务个性化，公司设有风云榜、热门品牌以及招商加盟等特色，强势打造品牌力量助力企业快速成长，招商加盟将需求有效准确展现给全国优质有意合作商，实现合作共赢</p>
    <div class="footer-text">欢迎访问汇融名企，汇融名企等您加入！</div>
  </div>
</div>
<script src="./js/jquery-1.11.0.min.js"></script>
<script src="./js/jquery.tmpl.min.js"></script>
<script src="./js/utils.js"></script>
<script type="text/x-jquery-tmpl" id="footer-top"></script>
<script type="text/javascript">
  setTimeout(function () {
    $(function () {
      var params = {
        city_id: sessionStorage.getItem('city_id'),
      }
      var api = new ajax('GET', '/api/home/cityList', params)
      api.then(function (res) {
        initFooter(JSON.parse(res).data)
      })
    })
  }, 600)
  function initFooter(data) {
    // 顶部定位为全国时底部也设置为全国
    $('#province-name').text(data.province || '国')
    var city = [{ cityid: null, name: '全国' }]
    setTimeout(function () {
      $('#city-all').append(
        onCitydata(data.city.length === 0 ? city : data.city)
      )
      $('#city-periphery').append(
        onCitydata(data.peripheryCity.length === 0 ? city : data.city)
      )
      $('#city-hot').append(onCitydata(data.hotCity))
      $('.footer-select').click(onCityItemClick)
      onFooterchange()
      window.onresize = function () {
        onFooterchange()
      }
    })
    // MultiTextOverflow($('.city-name'))
  }
  function onFooterchange() {
    var pHeight = $('.footer-top-item .city-name p').height()
    var cityName = $('.footer-top-item .city-name')
    cityName.css('height', pHeight * 5 + 'px')
  }
  function onCitydata(data) {
    var el = ''
    for (key in data) {
      var currentData = data[key]
      var temp =
        '<p id="' +
        (currentData.cityid || currentData.city_id) +
        '" class="footer-select" style="display: inline-block">' +
        (key == data.length - 1
          ? (currentData.name || currentData.city_name) + '</p>'
          : (currentData.name || currentData.city_name) + '</p>/ ')
      el += temp
    }
    return el
  }
</script>
